import React, { Component } from 'react'
import propTypes from 'prop-types'

export class SubCounter extends Component {
  static propTypes = {
    subClick: propTypes.func.isRequired,
  }

  subCount(count) {
    this.props.subClick(count)
  }

  render() {
    return (
      <div>
        <button onClick={() => this.subCount(1)}>-1</button>
        <button onClick={() => this.subCount(5)}>-5</button>
        <button onClick={() => this.subCount(10)}>-10</button>
      </div>
    )
  }
}

export default SubCounter
